package com.hw.graphql.controller;

import com.github.pagehelper.PageHelper;
import com.hw.graphql.mapper.UserMapper;
import com.hw.graphql.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @program: spring-graphql
 * @description: 普通controller，与graphql兼容
 * @author: hewei
 * @date: 2021-10-25 17:22
 **/
@RestController
@RequestMapping("user")
public class UserController {
    @Autowired
    UserMapper userMapper;

    @PostMapping("/all")
    public List<User> allUsers(){
        return userMapper.selectList(null);
    }

    @PostMapping("/addUser")
    public int selectByAddr(User user){
        return userMapper.insert(user);
    }
}
